<cfcomponent extends="base">

<cffunction access="public" name="GET">

<form action="" method="post" name="login_script" >
<table align="center" id="login">
<tr><td align="right">
Username:</td>
<td alig="left">
<input type="text" name="user" size="25" value="">
</td>
</tr>
<tr>
<td align="right">
Password:</td>
<td align="left">
<input type="password" name="passcode" size="25">
</td>
<tr>
<td>&nbsp;</td>
<td align="left">
<input name="submit" type="submit" value="Submit" alt="Login" class="button">
</td></tr></table>
</form>
</cffunction>

<cffunction access="public" name="POST">

<cfset Session.username = "#FORM.user#">
<cfinvoke component="components.data" returnvariable="query_results" method="login_auth"  user_id="#FORM.user#" passcode="#FORM.passcode#">
<cfif query_results.recordcount neq 0>
<cfset Session.is_valid_user = "true">
<cfset Session.email = "#query_results.email#">
	<cfif cgi.HTTP_REFERER neq "http://127.0.0.1:8500/timeout.cfm" or cgi.HTTP_REFERER neq "http://bfrick22.com/timeout.cfm">
	<cflocation url="/search.cfm" ADDTOKEN="No">
	<cfelse>
	<cflocation url="/search.cfm" ADDTOKEN="No">
	</cfif>
<cfelse>
<form action="" method="post" name="login_script" >
<table align="center" id="login">
<tr><td align="right">
Username:</td>
<td align="left">
<input type="text" name="user" size="25" value="<cfoutput>#form.user#</cfoutput>">
</td>
</tr>
<tr>
<td align="right">
Password:</td>
<td align="left">
<input type="password" name="passcode" size="25">
</td>
<tr>
<td>&nbsp;</td>
<td align="left">
<input name="submit" type="submit" value="Submit" alt="Login" class="button">&nbsp;<strong>Failed Login Try Again</strong>
</td></tr></table>
</form>
</cfif>
</cffunction>

</cfcomponent>
